#include<bits/stdc++.h>
using namespace std;
long long n,x,ma=-1,a[100001]={0};
long long int min(long long a,long long b){
	if(a>b)a=b;
	return a;
}
long long int max(long long a,long long b){
	if(a<b)a=b;
	return a;
}
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>x;
if(x>ma)ma=x;
a[x]++;
}

x=n;
for(int i=1;i<=ma;i++)
    if(a[i]*2<=n&&n-x<=a[i]){n-=min(x,a[i]),x=max(0,x-a[i]*2);}
    else if(a[i]<n&&x&&x-a[i]<a[i]){cout<<a[i];return 0;}
    else if(a[i]<n&&x&&n-x<a[i]){cout<<x;return 0;}
    else {cout<<n;return 0;}
cout<<n;
return 0;
}
